<div class="admin edit goods">

	<a class="btn add" href="<?php $params = array(); if($categoryId > 0) {$params['categoryId'] = $categoryId;} echo $this->createUrl('/admin/goods/editor/', $params); ?>">Добавить товар</a>
    <h1>Редактор товару</h1>

	<div class="clear"></div>

	<form action="" method="post">
		<?php if($oRow && $oRow->id > 0): ?>
			<input type="hidden" name="id" value="<?php echo $oRow->id; ?>" />
		<?php endif; ?>

		<?php if(!empty($oRow->original_url)): ?>
			<div class="item">
				<a target="_blank" href="<?php echo $oRow->original_url; ?>"><?php echo $oRow->original_url; ?></a>
			</div>
		<?php endif; ?>

		<div class="item">
			<label>Категория</label>
			<?php echo $this->widget('ext.fields.TreeCategories', array('selectId' => ($categoryId ? $categoryId : $oRow->category_id))); ?>
		</div>

		<div class="item">
			<label>URL товара</label>
			<input type="text" name="original_url" value="<?php echo !empty($oRow->original_url) ? $oRow->original_url : ''; ?>" />
		</div>

		<div class="item">
			<label>Парсер</label>
			<select class="select" name="parser_id">
				<option value="">-------------------</option>
				<?php
				if($oParsers)
				{
					foreach($oParsers as $oParser)
					{
						?>
						<option <?php echo $oParser->id == $oRow->parser_id ? ' selected=""' : ''; ?> value="<?php echo $oParser->id; ?>"><?php echo $oParser->title; ?></option>
					<?php
					}
				}
				?>
			</select>
		</div>

		<div class="clear"></div>

		<div class="item">
			<label>Код связи по цвету</label>
			<input type="text" name="color_bind" value="<?php echo !empty($oRow->color_bind) ? $oRow->color_bind : ''; ?>" />
		</div>

		<div class="item">
			<label>Назва</label>
			<input type="text" name="title" value="<?php echo !empty($oRow->title) ? $oRow->title : ''; ?>" />
		</div>

		<div class="item">
			<label>Alias</label>
			<input type="text" name="alias" value="<?php echo !empty($oRow->alias) ? $oRow->alias : ''; ?>" />
		</div>

		<div class="item">
			<label>Опис</label>
			<textarea class="editor" name="description"><?php echo !empty($oRow->description) ? $oRow->description : ''; ?></textarea>
		</div>

		<div class="item">
			<label>Meta keywords</label>
			<input type="text" name="meta_keywords" value="<?php echo !empty($oRow->meta_keywords) ? $oRow->meta_keywords : ''; ?>" />
		</div>

		<div class="item">
			<label>Meta description</label>
			<input type="text" name="meta_description" value="<?php echo !empty($oRow->meta_description) ? $oRow->meta_description : ''; ?>" />
		</div>


		<div class="clear"></div>

		<div class="item">
			<label>Цена $</label>
			<input type="text" class="price" name="price" value="<?php echo !empty($oRow->price) ? $oRow->price : ''; ?>" />

			<label>Старая цена $</label>
			<input type="text" class="price" name="old_price" value="<?php echo !empty($oRow->old_price) ? $oRow->old_price : ''; ?>" />
		</div>

		<div class="item">
			<label>Похожие товары</label>
			<input type="text" name="related" value="<?php echo !empty($oRow->related) ? $oRow->related : ''; ?>" />
		</div>

		<div class="item checkbox">
			<label class="radio"><input type="checkbox" name="is_top" value="1" <?php echo !empty($oRow->is_top) && $oRow->is_top ? ' checked=""' : ''; ?> /> <span>Топ товар</span></label>

			<label class="radio"><input type="checkbox" name="to_social" value="1" /> <span>Отправить в социальные сети</span></label>
		</div>

		<div class="clear"></div>

		<div class="item properties">
			<label>Фильтры</label>
			<div id="properties-wrapper">
				<?php echo $this->renderPartial('properties', array('oProperties' => $oProperties, 'aGoodsProperties' => $aGoodsProperties)); ?>
			</div>
		</div>

		<div class="clear"></div>

		<div class="item">
			<label>Фотографии &nbsp; <a target="_blank" href="<?php echo $this->createUrl('/admin/goods/storePhotos', array('id' => $oRow->id)); ?>">загрузить из магазина</a></label>
			<?php echo $this->widget('ext.fields.UploadImages', array('oRow' => $oRow)); ?>
		</div>

		<div class="item">
			<label>Видео</label>
			<?php echo $this->widget('ext.fields.UploadVideo', array('oRow' => $oRow)); ?>
		</div>

		<div class="clear"></div>

        <div class="item btn">
            <button type="submit"><span>Зберегти</span></button>
        </div>
    </form>

<!--	<div id="frame"></div>-->

</div>